GdkGLContext *context = GDK_GL_CONTEXT (gobject);
GdkWin32GLContext *context_win32 = GDK_WIN32_GL_CONTEXT (gobject);
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (gdk_gl_context_get_display (context));
+ GdkWindow *window = gdk_gl_context_get_window (context);
if (context_win32->hglrc != NULL)
{
ReleaseDC (display_win32->gl_hwnd, context_win32->gl_hdc);
}
+ if (window != NULL && window->impl != NULL)
+ {
+ GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
+
+ if (impl->suppress_layered > 0)
+ impl->suppress_layered--;
+
+ /* If we don't have any window that forces layered windows off,
+ * trigger update_style_bits() to enable layered windows again
+ */
+ if (impl->suppress_layered == 0)
+ gdk_window_set_type_hint (window, gdk_window_get_type_hint (window));
+ }
+
G_OBJECT_CLASS (gdk_win32_gl_context_parent_class)->dispose (gobject);
}
gint glver_major = 0;
gint glver_minor = 0;
+ GdkWindow *window = gdk_gl_context_get_window (context);
+ GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
+
if (!_set_pixformat_for_hdc (context_win32->gl_hdc,
&pixel_format,
context_win32->need_alpha_bits))
context_win32->hglrc = hglrc;
+ /* OpenGL does not work with WS_EX_LAYERED enabled, so we need to
+ * disable WS_EX_LAYERED when we acquire a valid HGLRC
+ */
+ impl->suppress_layered++;
+
+ /* if this is the first time a GL context is acquired for the window,
+ * disable layered windows by triggering update_style_bits()
+ */
+ if (impl->suppress_layered == 1)
+ gdk_window_set_type_hint (window, gdk_window_get_type_hint (window));
+
return TRUE;
}
window_rect.right -= _gdk_offset_x;
window_rect.top -= _gdk_offset_y;
window_rect.bottom -= _gdk_offset_y;
-
if (!impl->layered)
{
GDK_NOTE (EVENTS, g_print ("Setting window position ... "));
/* We can get away with using layered windows
* only when no decorations are needed. It can mean
* CSD or borderless non-CSD windows (tooltips?).
+ *
+ * If this window cannot use layered windows, disable it always.
+ * This currently applies to windows using OpenGL, which
+ * does not work with layered windows.
*/
- if (_gdk_win32_window_lacks_wm_decorations (window))
- impl->layered = g_strcmp0 (g_getenv ("GDK_WIN32_LAYERED"), "0") != 0;
+ if (impl->suppress_layered == 0)
+ {
+ if (_gdk_win32_window_lacks_wm_decorations (window))
+ impl->layered = g_strcmp0 (g_getenv ("GDK_WIN32_LAYERED"), "0") != 0;
+ }
+ else
+ impl->layered = FALSE;
if (impl->layered)
new_exstyle |= WS_EX_LAYERED;